/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package utilitaire;

/**
 *
 * @author romain_lou
 */
public class Calculs {
    private Double x;
    private Double y;
    private Double delX;
    private Double delY;
    private Double gamma;
    private Double r;
    private Double latiso;
    private Double sinPhiIt0;
    private Double sinPhiIt1;
    private Double sinPhiIt2;
    private Double sinPhiIt3;
    private Double sinPhiIt4;
    private Double sinPhiIt5;
    private Double sinPhiIt6;
    private Double longRad;
    private Double latRad;
    private Double longitude;
    private Double latitude;


    /**
     *
     * @param x x à convertir
     * @param y y à convertir
     */
    public Calculs(Double x, Double y) {
        this.x = x;
        this.y = y;

    }

    public Double getDelX() {
        return this.x - Constantes.getXs();
    }

    public void setDelX(Double delX) {
        this.delX = delX;
    }

    public Double getDelY() {
        return this.y - Constantes.getYs();
    }

    public void setDelY(Double delY) {
        this.delY = delY;
    }

    public Double getGamma() {
        return Math.atan(-getDelX()/getDelY());
    }

    public void setGamma(Double gamma) {
        this.gamma = gamma;
    }

    public Double getLatRad() {
        return Math.asin(getSinPhiIt6());
    }

    public void setLatRad(Double latRad) {
        this.latRad = latRad;
    }

    public Double getLatiso() {
        return (Math.log(Constantes.getC()/getR()))/(Constantes.getN());
    }

    public void setLatiso(Double latiso) {
        this.latiso = latiso;
    }

    public Double getLongRad() {
        return getGamma()/Constantes.getN()+Constantes.getD()/180*Math.PI;
    }

    public void setLongRad(Double longRad) {
        this.longRad = longRad;
    }

    public Double getR() {
        return Math.sqrt(Math.pow(getDelX(), 2)+Math.pow(getDelY(), 2));
    }

    public void setR(Double r) {
        this.r = r;
    }

    public Double getSinPhiIt0() {
        return Math.tanh(getLatiso()+(Constantes.getE())*(getarc(Constantes.getE()*Math.sin(1))));
    }

    public void setSinPhiIt0(Double sinPhiIt0) {
        this.sinPhiIt0 = sinPhiIt0;
    }

    public Double getSinPhiIt1() {
        return Math.tanh(getLatiso()+(Constantes.getE())*(getarc(Constantes.getE()*getSinPhiIt0())));
    }

    public void setSinPhiIt1(Double sinPhiIt1) {
        this.sinPhiIt1 = sinPhiIt1;
    }

    public Double getSinPhiIt2() {
        return Math.tanh(getLatiso()+(Constantes.getE())*(getarc(Constantes.getE()*getSinPhiIt1())));
    }

    public void setSinPhiIt2(Double sinPhiIt2) {
        this.sinPhiIt2 = sinPhiIt2;
    }

    public Double getSinPhiIt3() {
        return Math.tanh(getLatiso()+(Constantes.getE())*(getarc(Constantes.getE()*getSinPhiIt2())));
    }

    public void setSinPhiIt3(Double sinPhiIt3) {
        this.sinPhiIt3 = sinPhiIt3;
    }

    public Double getSinPhiIt4() {
        return Math.tanh(getLatiso()+(Constantes.getE())*(getarc(Constantes.getE()*getSinPhiIt3())));
    }

    public void setSinPhiIt4(Double sinPhiIt4) {
        this.sinPhiIt4 = sinPhiIt4;
    }

    public Double getSinPhiIt5() {
        return Math.tanh(getLatiso()+(Constantes.getE())*(getarc(Constantes.getE()*getSinPhiIt4())));
    }

    public void setSinPhiIt5(Double sinPhiIt5) {
        this.sinPhiIt5 = sinPhiIt5;
    }

    public Double getSinPhiIt6() {
        return Math.tanh(getLatiso()+(Constantes.getE())*(getarc(Constantes.getE()*getSinPhiIt5())));
    }

    public void setSinPhiIt6(Double sinPhiIt6) {
        this.sinPhiIt6 = sinPhiIt6;
    }

    public Double getX() {
        return x;
    }

    public void setX(Double x) {
        this.x = x;
    }

    public Double getY() {
        return y;
    }

    public void setY(Double y) {
        this.y = y;
    }

    public static double getarc(Double x){
        return ((0.5)*(Math.log((1+(x))/(1-(x)))));
    }

    public Double getLatitude() {
        return getLatRad()/Math.PI*180;
    }

    public void setLatitude(Double latitude) {
        this.latitude = latitude;
    }

    public Double getLongitude() {
        //=Q15/PI()*180
        return getLongRad()/Math.PI*180;
    }

    public void setLongiturde(Double longitude) {
        this.longitude = longitude;
    }

    

}
